﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MPR.Poker.Model.SYS;

namespace PokerLife.Models.SYS
{
    public class UserViewModel
    {
        //[ScaffoldColumn(false)]
        [HiddenInput(DisplayValue = false)]
        public int IDSys { get; set; }

        [Required]
        [Display(Name="User")]
        public string UserName { get; set; }

        [Required]
        [Display(Name="Password")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Display(Name = "Note")]
        public string Note { get; set; }

        [Display(Name = "Actived")]
        public bool IsActived { get; set; }


        public static SYS_User ConvertTo(PokerLife.Models.SYS.UserViewModel obj)
        {
            SYS_User objUser=new SYS_User();
            objUser.IDSys = obj.IDSys;
            objUser.UserName = obj.UserName;
            objUser.Password = obj.Password;
            objUser.Note = obj.Note;
            objUser.IsActived = obj.IsActived;
            return objUser;
        }

        public static PokerLife.Models.SYS.UserViewModel ConvertToModel(SYS_User obj)
        {
            PokerLife.Models.SYS.UserViewModel objUser = new PokerLife.Models.SYS.UserViewModel();
            objUser.IDSys = obj.IDSys;
            objUser.UserName = obj.UserName;
            objUser.Password = obj.Password;
            objUser.Note = obj.Note;
            objUser.IsActived = obj.IsActived;
            return objUser;
        }
    }
    
}